package storage.statistics;

public class StatisticFactory {

  private static StatisticFactory _instance = new StatisticFactory();
  
  private StatisticFactory() {
    
  }
  
  public static StatisticFactory getInstance() {
    return _instance;
  }
  
  public Object clone() throws CloneNotSupportedException {
    throw new CloneNotSupportedException(); 
  }
  
  public Statistic getStatistic(String statType, String value) {
    if(statType.equals(StatisticType.MAX_TEMP.getDescription()))
      return new MaxTemperatureStatistic(value);
    
    else if(statType.equals(StatisticType.MIN_TEMP.getDescription()))
      return new MinTemperatureStatistic(value);
    
    else if(statType.equals(StatisticType.MEAN_TEMP_REGION.getDescription()))
      return new MeanRegionStatistic(value);
    
    else if(statType.equals(StatisticType.MEAN_TEMP_TIME.getDescription()))
      return new MeanTimeStatistic(value);
    
    else
      return null;
  }
}
